#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream >
#include <string>
using namespace std;
int main()
{
	int a = 123;
	int b = 0;
	string ret;
	while (a)
	{
		b = a % 10;
		ret.push_back(b + '0');
		a = a / 10;
	}
	auto it = ret.rbegin();
	while (it != ret.rend())
	{
		cout << *it<<" ";
		it++;
	}
}